
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>
    <?php
        // 服务器端渲染页面

        $arr = array();
        
        $arr['123'] = array('username'=>"张三",'chinese'=>'130','math'=>'149','english'=>'146','summary'=>'298');
        $arr['124'] = array('username'=>"李四",'chinese'=>'132','math'=>'109','english'=>'126','summary'=>'218');
        $arr['125'] = array('username'=>"王五",'chinese'=>'112','math'=>'129','english'=>'136','summary'=>'228');
        $arr['126'] = array('username'=>"赵六",'chinese'=>'121','math'=>'119','english'=>'116','summary'=>'238');
       
        $code = $_POST['code'];

        if($code=='admin'){
            foreach($arr as $v){
                echo "<ul>
                    <li>姓名：$v[username]</li>
                    <li>语文：$v[chinese]</li>
                    <li>数学：$v[math]</li>
                    <li>英语：$v[english]</li>
                    <li>综合：$v[summary]</li>
                    </ul>";
            }
        }else{
            $score = $arr[$code];
            echo "<ul>
            <li>姓名：$score[username]</li>
            <li>语文：$score[chinese]</li>
            <li>数学：$score[math]</li>
            <li>英语：$score[english]</li>
            <li>综合：$score[summary]</li>
            </ul>";
        }
        
    ?>
    </div>
</body>
</html>
